runserver error

by: Lopez, 7 years ago

Last edited: 7 years ago

Hi! I follow your django tutorial. It's very good. I like it very much. I am just on part 2 now. So my problem When I run the server I got this error:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001A31EE56BF8>
Traceback (most recent call last):
  File "C:/Python36/lib/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "C:/Python36/lib/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "C:/Python36/lib/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "C:/Python36/lib/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:/Python36/lib/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:/Python36/lib/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "C:/Python36/lib/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "C:/Python36/lib/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "C:/Python36/lib/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:/Python36/lib/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:/Python36/lib/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:/Python36/lib/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:/Python36/lib/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:/Development/mysite/mysite/urls.py", line 21, in <module>
    url(r'^webapp/', include('webapp.urls')),
NameError: name 'include' is not defined

I tired reinstall everything. It did not help. Please help me how can I fix that.
my python verison: 3.6.3
       django version: 1.11.7



You must be logged in to post. Please login or register an account.



Have you imported 'include' from django.conf.urls ? Make sure you have the following at the top of your py-file:


from django.conf.urls import include


If not, it might help if you copy/paste your code. It will make it easier for us to spot the mistake

-kentaasvang 7 years ago
Last edited 7 years ago

You must be logged in to post. Please login or register an account.


Thanks mate. You were right. I missed the include. I spent lot of time with this and I did not notice.
Thanks again the reply.

-Lopez 7 years ago

You must be logged in to post. Please login or register an account.


Glad I could help.

-kentaasvang 7 years ago

You must be logged in to post. Please login or register an account.


pls can you help i have similar error, tried to import the include still getting error

-fabiancy 2 years ago

You must be logged in to post. Please login or register an account.